magento check stock qty est out stock

$_product=Mage::getModel('catalog/product')->getCollection()->addAttributeToFilter('type_id', array('eq' => 'simple'));
foreach($_product as $p) {


    $stock=Mage::getModel('cataloginventory/stock_item')->loadByProduct($p);

    if($stock->getIsInStock()==="0"&&$stock->getQty()>=1)
    {
        echo $p->getSku();
        echo '<br/>';
        echo $p->getId();
        echo '<br/>';
    }




}

Leave a Comment